package com.yan.dao.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.yan.dao.entity.BookRating;
import com.yan.dao.entity.Books;
import com.yan.dao.entity.Borrows;
import com.yan.dao.entity.PersonMessage;
import com.yan.dao.entity.Reserve;
import com.yan.dao.entity.SuggestBuy;
import com.yan.dao.entity.Users;

public interface BooksMapper {
	
	//1.用户查询书籍
	List<Books> getAllBooks(Books book);

	//2.根据图书名称和类别查询图书的数量
	int getCount(Books book);

	//3.借阅书籍信息
	Books getBook(Integer id);

	//4.确认借阅书籍
	void insertBorrow(Borrows borrow);

	//5.查询借阅的书籍
	List<Borrows> getBorrows(Borrows borrow);

	//6.查询需要归还的书籍
	List<Borrows> getBacks(Borrows borrow);

	//根据借书表的uid查询数量
	int getBorrowCount(int uid);
	//7.申请归还
	void updateBacks(Integer id);

	//8.预定信息
	void insertReserve(Reserve reserve);

	//9.查询预定书籍信息
	List<Reserve> getReserveBook(Integer id);

	//10.查询是否存在用户
	Users selectUser(Users user);
	
	//11.根据书名和作者查询建购表
	SuggestBuy selectSuggestBuy(SuggestBuy suggestbuy);
	
	//12.根据id向建构表中的sunum加1
	void updateSuggestBuy(int id);
	
	//13.向建议购买表中插入一条数据
	void insertSuggestBuy(SuggestBuy suggestbuy);
	
	//14.根据用户id查询个人信息表
	PersonMessage selectPersonMessage(int uid);
	
	//15.插入个人信息行
	void insertPersonMessage(int uid);
	
	//16.更新个人信息
	void updatePersonMessage(PersonMessage personMessage);
	
	//17.插入查询信息
	void insertSelectInfo(Books book);
	
	//18.根据还书id查询书的信息
	Books selectBackedBook(Integer id);
	
	//19.想评分表插入评分信息
	void insertBookPingFen(BookRating bookrating);
	
	//20.更新还书表状态
	void updateBackBookToPingFen(int id);
	
	//21.查询图书评分表
	List<BookRating> selectBookRating(int bookid);
	
	//22.游客界面图书推荐查询
	List<BookRating> selectBookTuijian();
	
	//23.用户图书推荐
	List<BookRating> selectBookTuijian1(int userid);
	
	//24.点赞操作
	Integer selectBookratingType(@Param("uid") int uid, @Param("bkid") int bkid, @Param("suid") int suid);
	void updateUpType(@Param("uid") int uid, @Param("bkid") int bkid, @Param("suid") int suid, @Param("type") int type);
	void updateUpDec(@Param("uid") int uid, @Param("bkid") int bkid);
	void updateDownDec(@Param("uid") int uid, @Param("bkid") int bkid);
	void updateUpAdd(@Param("uid") int uid, @Param("bkid") int bkid);
	void updateDownAdd(@Param("uid") int uid, @Param("bkid") int bkid);
	Integer selectUpNum(@Param("uid") int uid, @Param("bkid") int bkid);
	Integer selectDownNum(@Param("uid") int uid, @Param("bkid") int bkid);
	void insertUoDnote(@Param("uid") int uid, @Param("bkid") int bkid, @Param("suid") int suid, @Param("type") int type);
	
	
}
